import Mock from 'mockjs'
import banner from './banner.json'
import List from './index.json'
import Dog from './dogs.json'
import Cat from './cat.json'

// banner
Mock.mock('/api/banner','get',() => {
    return banner
})

//首页列表数据

Mock.mock('/api/list','get',() => {
    return List
})

//获取详情的接口

Mock.mock('/api/detail','get',(config:any) => {
    console.log(config)
    let params = JSON.parse(config.body);
    return List.data.find(item => item.id == params.id)
})

//获取种类
Mock.mock('/api/speed','get',(config:any) => {
    let {id} = JSON.parse(config.body);
    if(id === '1'){
        return Dog
    }else if(id === '2'){
        return Cat
    }else{
        return {
            "code": 10000,
            "message": "\u64cd\u4f5c\u6210\u529f",
            "seqnum": "GMCAMERAARD1542605171558270583",
            "data":[]
        }
    }
})